﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RenderEngineInterfaces
{
    /// <summary>
    /// Implement this along side the IRenderItem interface if you are going to write
    /// out composable units - or enable your results to be cached as a deep zoom sub-image.
    /// </summary>
    public interface IRenderableObjectCompare
    {
        /// <summary>
        /// Returns the Hash of an object that this renderer can render. This hash is used
        /// to cache results in a database.
        /// </summary>
        /// <param name="what"></param>
        /// <returns></returns>
        long GetObjectHash(object what);

        /// <summary>
        /// A careful compare to see if two objects are equal. This is a deep comparison
        /// (i.e. for FileInfo the strings for FullPath are compared).
        /// </summary>
        /// <param name="o1"></param>
        /// <param name="o2"></param>
        /// <returns></returns>
        bool ObjectsEqual(object o1, object o2);

        /// <summary>
        /// Check if the object is out of date and needs to be re-rendered. The metadata
        /// is the same object that was passed in the SetComposableUnit - could be a DateTime,
        /// for example.
        /// </summary>
        /// <param name="what"></param>
        /// <param name="metaData"></param>
        /// <returns></returns>
        bool IsOutOfDate(object what, object metaData);

        /// <summary>
        /// Returns the meta data to be cached that can be used to determine if this object is
        /// out of date.
        /// </summary>
        /// <param name="what"></param>
        /// <returns></returns>
        object GetObjectDateMetaData(object what);
    }
}
